﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

using ProjectEuler.UI;

namespace ProjectEuler.Data
{
    internal sealed class ProblemStatusToImageSourceConverter : IValueConverter
    {
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            if (value is ProblemStatus)
            {
                return Application.Current.TryFindResource(ProblemStatusImages.MakeKey(value));
            }

            return null;
        }

        public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
